

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Generate a Package [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Code Engineering,Code Engineering Generate Package,Code Engineering Generate Package Source Code,Partial Class,Partial Class Generate,Class,Class Partial, Generate">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Generate a Package</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="generateagroupofclasses.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="synchronizepackagetree.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">In addition to generating source code from single Classes and groups of Classes, you can also generate code from a package. This feature provides options to recursively generate child packages and automatically generate directory structures based on the package hierarchy. This enables you to generate a whole branch of your project model in one step.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Generate a Package</span></p>
<p class="p_BodyText"><span class="f_BodyText">To generate a package, follow the steps below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">In the </span><span class="f_UIControl">Project Browser</span><span class="f_NumberedList">, right-click on the package to generate code for. The context menu displays.</span></li>
<li value=2><span class="f_NumberedList">Select the </span><span class="f_MenuKeyField">Code Engineering | Generate Source Code</span><span class="f_NumberedList"> menu option. The </span><span class="f_UIControl">Generate Package Source Code</span><span class="f_NumberedList"> dialog displays.</span><br>
<span class="f_NumberedList">&nbsp;</span><br>
<img src="generatecodedialog.png" width="503" height="340" border="0" alt="GenerateCodeDialog"><br>
<span class="f_NumberedList">&nbsp;</span></li>
<li value=3><span class="f_NumberedList">In the </span><span class="f_MenuKeyField">Synchronize</span><span class="f_NumberedList"> field, click on the drop-down arrow and select the appropriate synchronize option:</span></li>
</ol>
<ul style="text-indent: 0px; margin-left: 65px; list-style-position: outside;">
<li><span class="f_MenuKeyField">Synchronize model and code</span><span class="f_Bulletlist3">: Classes with existing files are forward synchronized with that file; Classes with no existing file are generated to the displayed target file</span></li>
<li><span class="f_MenuKeyField">Overwrite code</span><span class="f_Bulletlist3">: All selected target files are overwritten (forward generated)</span></li>
<li><span class="f_MenuKeyField">Do not generate</span><span class="f_Bulletlist3">: Only selected Classes that do not have an existing file are generated; all other Classes are ignored.</span></li>
</ul>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=4><span class="f_NumberedList">Highlight the Classes to generate. Leave unselected any to not generate.</span></li>
<li value=5><span class="f_NumberedList">To make Enterprise Architect automatically generate directories and filenames based on the package hierarchy, select the </span><span class="f_MenuKeyField">Auto Generate Files</span><span class="f_NumberedList"> checkbox. This then enables the </span><span class="f_MenuKeyField">Root Directory</span><span class="f_NumberedList"> field, in which you select a root directory under which the source directories are to be generated. By default, the </span><span class="f_MenuKeyField">Auto Generate Files</span><span class="f_NumberedList"> feature </span><span class="f_NumberedList" style="font-style: italic;">ignores</span><span class="f_NumberedList"> any file paths that are already associated with a Class. You can change this behavior by also selecting the </span><span class="f_MenuKeyField">Retain Existing File Paths</span><span class="f_NumberedList"> checkbox.</span></li>
<li value=6><span class="f_NumberedList">To include all sub-packages in the output, select the </span><span class="f_MenuKeyField">Include Child Packages</span><span class="f_NumberedList"> checkbox.</span></li>
<li value=7><span class="f_NumberedList">Click on the </span><span class="f_MenuKeyField">Generate</span><span class="f_NumberedList"> button to start generating code.</span></li>
</ol>
<p class="p_BodyText"><span class="f_BodyText">As code generation proceeds Enterprise Architect displays progress messages. If a Class requires an output filename Enterprise Architect prompts you to enter one at the appropriate time (assuming </span><span class="f_MenuKeyField">Auto Generate Files</span><span class="f_BodyText"> is not selected). For example, if the selected Classes include partial Classes, a prompt displays to enter the filename for the second partial Class.</span></p>
<p class="p_BodyText"><span class="f_BodyText">For additional information on the options on the </span><span class="f_UIControl">Generate Package Source Code</span><span class="f_BodyText"> dialog, see the following table:</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="0" border="0" style="border: none; border-spacing:0px; border-collapse: collapse;">
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" bgcolor="#e3e6ed" style="width:172px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Option</span></p>
</td>
<td valign="top" width="435" bgcolor="#e3e6ed" style="width:435px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Use to</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Root Package</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Check the name of the package to be generated.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Synchronize</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Select options that specify how existing files should be generated.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Auto Generate Files</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Specify whether Enterprise Architect should automatically generate file names and directories, based on the package hierarchy.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Root Directory</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">If </span><span class="f_MenuKeyField">Auto Generate Files</span><span class="f_Tabletext"> is selected, display the path under which the generated directory structures are created. </span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Retain Existing File Paths</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">If </span><span class="f_MenuKeyField">Auto Generate Files</span><span class="f_Tabletext"> is selected, specify whether to use existing file paths associated with Classes. If unselected, Enterprise Architect generates Classes to automatically determined paths, regardless of whether source files are already associated with Classes.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Include all Child Packages</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Include all Classes from all sub-packages of the target package in the list. This option facilitates recursive generation of a given package and its sub-packages.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Select Objects to Generate</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">List all Classes that are available for generation under the target packages. Only selected (highlighted) Classes are generated. Classes are listed with their target source file.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Select All</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Mark all Classes in the list as selected.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Select None</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Mark all Classes in the list as unselected.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Generate</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Start the generation of all selected Classes.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="172" style="width:172px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Cancel</span></p>
</td>
<td valign="top" width="435" style="width:435px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Exit the </span><span class="f_UIControl">Generate Package Source Code</span><span class="f_Tabletext"> dialog. No Classes are generated.</span></p>
</td>
</tr>
</table>
</div>




            </div>
          </div>
        </div>



</div>


</body>
</html>
